<template>
  <div>
    <el-table
      :data="storehouseList"
      height="250"
      border
      style="width: 100%"
    >
      <el-table-column
        prop="warehouseId"
        label="仓库编号"
        width="180"
      />
      <el-table-column
        prop="storehouseId"
        label="库位编号"
        width="180"
      />
      <el-table-column
        prop="desc"
        label="名称描述"
      />
      <el-table-column
        prop="inventory"
        label="库存能力"
      />
      <el-table-column
        prop=""
        label="操作"
      >
        <template slot-scope="scope">
          <el-button type="text" size="small" @click="resetStorehouseInfo(scope.row)">修改</el-button>
          <del-btn :title="'是否确认删除编号为' + scope.row.storehouseId + '的库位？'" button-text="删除" @onConfirm="delFun(scope.row)" />
        </template>
      </el-table-column>
    </el-table>
    <storehouse-form ref="storehouseForm" title="修改" />
  </div>
</template>

<script>
import delBtn from '@/components/DelConfirm'
import storehouseForm from './storehouse-form'
export default {
  components: {
    delBtn,
    storehouseForm
  },
  props: {
    storehouseList: {
      type: Array,
      default() {
        return []
      }
    }
  },
  data() {
    return {
    }
  },
  methods: {
    delFun(row) {
      console.log('删除', row)
    },
    resetStorehouseInfo(row) {
      this.$refs.storehouseForm.dialogAddNew = true
      this.$refs.storehouseForm.storehouseForm = row
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
